#include <stdio.h>
int main()
{
    int i,x,total,num,a;
    char ch;
    while(1)
    {
    a=0;
    total=0;
    for(i=1;i<=3;i++)
    {
        printf("please ensure the type of the card of the three\n");
        printf("enter 1 for number and 2 for letter");
        scanf("%i",&x);
        if(x==1)
        {
            printf("please enter the number");
            scanf("%i",&num);
            total+=num;
        }
        else
        {
            printf("please enter the letter");
            scanf("%c",&ch);
            scanf("%c",&ch);
            if(ch == 'A')
            {total+=11;
            a++;}
            else if(ch == 'J'||ch == 'Q'||ch == 'K')
            {total+=10;}
        }
        printf("now the next card\n");
    }
    if(total>21)
    total=total-10*a;
    printf("The score is %i\n",total);
    }
    return 0;
}